# class Animal:
#     name='animal'
#     def short(self):
#         print('animal short')
#
# animal = Animal()
# print(animal.name)
# animal.short()
#只有类能更改属性
class Dog:
    name='dog'
    def __init__(self):
        self.age = 10
    def eat(self):
        print('dog eat')
dog = Dog()
print(dog.name)
dog.eat()

dog1 = Dog()
print(dog1.name)
print(Dog.name)
dog1.name='dddddd1'
print(dog1.name)
print(Dog.name)

Dog.name='dddddd2'
print(dog1.name)
print(Dog.name)
print('----------------')
#实例属性只能通过实例访问
dog2 = Dog()
print(dog2.name)
print(dog2.age)